# test_rp.launch.py
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.substitutions import Command
from launch_ros.parameter_descriptions import ParameterValue

def generate_launch_description():
    # 假设你在 test_urdf 包里有 urdf/test_urdf.urdf
    test_urdf_dir = get_package_share_directory('test_urdf')
    urdf_file = os.path.join(test_urdf_dir, 'urdf', 'test_urdf.urdf')

    # 展开 URDF
    robot_description = ParameterValue(Command(['xacro ', urdf_file]), value_type=str)

    return LaunchDescription([
        Node(
            package='robot_state_publisher',
            executable='robot_state_publisher',
            output='screen',
            parameters=[{'robot_description': robot_description}]
        )
    ])
